import { defineStore } from 'pinia';
type ReplaceText = Record<string | number, string | number> | (number | string)[];
export const useGlobalStore = defineStore('global', {
    state: () => {
        return {
            messages: <Record<string, string>>{},
            token: <string>'',
            lang: <'en' | 'ar' | 'ur' | 'tr' | 'in' | 'zh'>'en',
            isRtl: <boolean>false,
            username: <string>'', // 用户名
            displayUserId: <string>'', // 用户短ID
            userId: <string>'', // 用户长ID
            portrait: <string>'', // 用户头像
            isLoggedIn: <'YES' | 'NO' | 'LOGGING'>'LOGGING', // 是否已登录
            isLoadingMessage: <boolean>false, // 是否正在加载翻译文件

            show: {
                open: <boolean>false,
            },
            deviceType: '',

            isShowMMenus: false,
        };
    },
    actions: {
        setShow(show: { open: boolean }) {
            this.show = show;
        },
    },
    getters: {
        getMessage: state => {
            return (key: string, replaceText?: ReplaceText) => {};
        },
    },
});
